import CryptoJS from "crypto-js";
const aseKey = process.env.VUE_APP_BASE_ASE

class Refresh{
    /*
    * 加密
    * */
    encrypt(message){
        var encryptData = CryptoJS.AES.encrypt(message, CryptoJS.enc.Utf8.parse(aseKey), {
            mode: CryptoJS.mode.ECB,
            padding: CryptoJS.pad.Pkcs7
        }).toString();
        return encryptData
    }

    /*
    * 解密
    * */
    decrypt(encryptData){
        var decryptData = CryptoJS.AES.decrypt(encryptData, CryptoJS.enc.Utf8.parse(aseKey), {
            mode: CryptoJS.mode.ECB,
            padding: CryptoJS.pad.Pkcs7
        }).toString(CryptoJS.enc.Utf8);
        return decryptData
    }
}

export default new Refresh()